package com.tofix.kidmall.repo;

import com.tofix.kidmall.entity.Cart;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Optional;

public interface CartRepo extends JpaRepository<Cart, String> {
    //Optional<Cart> findByCartIdAnAndRoleName(String id, String name);

    @Query("select id from Cart id where id.cartId=:id")
    Cart get(String id);

    @Query(value = "select * from t_cart where cartId=:id", nativeQuery = true)
    Cart getData(@Param("id") String id);

    Cart findCartByCartId(String cartId);
}
